﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using Aioms.Common;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using Newtonsoft.Json;
using SqlSugar;

namespace Aioms.Models
{
    /// <summary>
    /// 报修Model
    /// </summary>
    [ExcelExporter(Name = "报修")]
    [SugarTable("notice_repair")]
    public class NoticeRepair
    {
        public NoticeRepair()
        {
            this.Created = DateTime.Now;
            this.Updated = DateTime.Now;
        }
        /// <summary>
        /// Desc:
        /// Default:
        /// Nullable:False
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")]
        public long Id { get; set; }

        /// <summary>
        /// Desc:企业Id
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "eid")]
        public long Eid { get; set; }

        /// <summary>
        /// Desc:报修单号
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "报修单号")]
        [SugarColumn(ColumnName = "rpnumber")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string RpNumber { get; set; }

        /// <summary>
        /// Desc:设备ID
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "dvid")]
        public long Dvid { get; set; }

        /// <summary>
        /// Desc:设备名称
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "设备名称")]
        [SugarColumn(ColumnName = "dvname")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Dvname { get; set; }

        /// <summary>
        /// Desc:设备ID
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "dvtid")]
        public long Dvtid { get; set; }

        /// <summary>
        /// Desc:设备名称
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "设备名称")]
        [SugarColumn(ColumnName = "dvtname")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Dvtname { get; set; }

        /// <summary>
        /// Desc:设备编号
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "设备编号")]
        [SugarColumn(ColumnName = "dvnumber")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Dvnumber { get; set; }

        /// <summary>
        /// Desc:规格型号
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "规格型号")]
        [SugarColumn(ColumnName = "specification")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Specification { get; set; }

        /// <summary>
        /// 设备位置
        /// </summary>           
        [ExporterHeader(DisplayName = "设备位置")]
        [SugarColumn(ColumnName = "dvposition")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string DvPosition { get; set; }

        /// <summary>
        /// 设备位置文字详细描述
        /// </summary>           
        [ExporterHeader(DisplayName = "位置详情")]
        [SugarColumn(ColumnName = "dvfulladdress")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string DvFullAddress { get; set; }

        /// <summary>
        /// Desc:生产厂商
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "生产厂商")]
        [SugarColumn(ColumnName = "manufacturer")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Manufacturer { get; set; } = "";

        /// <summary>
        /// 区域ID
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "aeid")]
        public long AeId { get; set; }

        /// <summary>
        /// 区域名称
        /// </summary>           
        [ExporterHeader(DisplayName = "区域名称")]
        [SugarColumn(ColumnName = "aename")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string AeName { get; set; }

        /// <summary>
        /// Desc:故障部位
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "故障部位")]
        [SugarColumn(ColumnName = "position")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Position { get; set; }

        /// <summary>
        /// Desc:故障等级
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "level")]
        public int Level { get; set; }

        /// <summary>
        /// 故障等级：1.轻微 2.一般 3.紧急
        /// </summary>    
        [ExporterHeader(DisplayName = "故障等级")]
        [SugarColumn(IsIgnore = true)]
        [JsonIgnore]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string LevelName { get; set; }

        /// <summary>
        /// Desc:是否停机 1是 0否
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "is_halt")]
        public int IsHalt { get; set; }

        /// <summary>
        /// 1.是 2.否
        /// </summary>
        [ExporterHeader(DisplayName = "是否停机")]
        [SugarColumn(IsIgnore = true)]
        [JsonIgnore]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string IsHaltName { get; set; }

        /// <summary>
        /// Desc:故障时间
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "故障时间", Format = "yyyy-mm-DD hh:mm:ss")]
        [SugarColumn(ColumnName = "trouble_time")]
        public DateTime TroubleTime { get; set; }

        /// <summary>
        /// Desc:故障描述
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "故障描述")]
        [SugarColumn(ColumnName = "description")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Description { get; set; } = "";

        /// <summary>
        /// Desc:图片
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "img_url", ColumnDataType = "text")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string ImgUrl { get; set; } = "";

        /// <summary>
        /// Desc:图片
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "video_url", ColumnDataType = "text")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string VideoUrl { get; set; } = "";

        /// <summary>
        /// Desc:图片
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "voice_url", ColumnDataType = "text")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string VoiceUrl { get; set; } = "";

        /// <summary>
        /// Desc:开始时间
        /// Default:
        /// Nullable:True
        /// </summary>           
        //[ExporterHeader(DisplayName = "开始时间", Format = "yyyy-mm-DD hh:mm:ss")]
        //[IEIgnore(IsExportIgnore = true)]
        //[SugarColumn(ColumnName = "begin_time")]
        //public DateTime BeginTime { get; set; }

        /// <summary>
        /// Desc:结束时间
        /// Default:
        /// Nullable:True
        /// </summary>           
        //[ExporterHeader(DisplayName = "结束时间", Format = "yyyy-mm-DD hh:mm:ss")]
        //[IEIgnore(IsExportIgnore = true)]
        //[SugarColumn(ColumnName = "end_time")]
        //public DateTime EndTime { get; set; }

        /// <summary>
        /// Desc:工时
        /// Default:
        /// Nullable:True
        /// </summary>           
        //[ExporterHeader(DisplayName = "工时")]
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "man_hour")]
        public int ManHour { get; set; }

        /// <summary>
        /// Desc:状态
        /// Default:
        /// Nullable:True
        /// </summary>           
        //[ExporterHeader(DisplayName = "状态")]
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "status")]
        public int Status { get; set; }

        /// <summary>
        /// Desc:排故流程
        /// Default:
        /// Nullable:True
        /// </summary>           
        //[ExporterHeader(DisplayName = "排故流程")]
        //[IEIgnore(IsExportIgnore = true)]
        //[SugarColumn(ColumnName = "procedure")]
        //public string Procedure { get; set; }

        /// <summary>
        /// Desc:维修结果json
        /// Default:
        /// Nullable:True
        /// </summary>           
        //[ExporterHeader(DisplayName = "维修结果")]
        //[IEIgnore(IsExportIgnore = true)]
        //[SugarColumn(ColumnName = "result")]
        //public string Result { get; set; }

        /// <summary>
        /// Desc:维修结果状态
        /// Default:
        /// Nullable:True
        /// </summary>           
        //[ExporterHeader(DisplayName = "维修结果状态")]
        //[IEIgnore(IsExportIgnore = true)]
        //[SugarColumn(ColumnName = "result_status")]
        //public string ResultStatus { get; set; } = "";

        /// <summary>
        /// Desc:审批流程json
        /// Default:
        /// Nullable:True
        /// </summary>   
        //[ExporterHeader(DisplayName = "审批流程json")]
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "chuli_result", ColumnDataType ="json", IsJson = true)]
        public List<ShenPiPersonInfo> ChuliResult { get; set; }
        //public string ChuliResult { get; set; }

        /// <summary>
        /// Desc:审批处理状态
        /// Default:
        /// Nullable:True
        /// </summary>           
        [ExporterHeader(DisplayName = "状态")]
        [SugarColumn(ColumnName = "chuli_status")]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string ChuliStatus { get; set; }

        /// <summary>
        /// Desc:是否是移动端巡检中的异常工单 1.是 0.否
        /// Default:
        /// Nullable:True
        /// </summary>           
        //[ExporterHeader(DisplayName = "是否是移动端巡检中的异常工单")]
        //[IEIgnore(IsExportIgnore = true)]
        //[SugarColumn(ColumnName = "is_exception")]
        //public int IsException { get; set; }

        /// <summary>
        /// Desc:报修人Id
        /// Default:
        /// Nullable:True
        /// </summary>           
        //[ExporterHeader(DisplayName = "报修人")]
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "sbepid")]
        public long Sbepid { get; set; }

        /// <summary>
        /// 报修人姓名
        /// </summary>
        [ExporterHeader(DisplayName = "报修人姓名")]
        [SugarColumn(ColumnName = "sbeprealname")]
        [JsonIgnore]
        [DisplayFormat(ConvertEmptyStringToNull = false)]
        public string SbepRealname { get; set; }

        /// <summary>
        /// Desc:审批人，按逗号分隔
        /// Default:
        /// Nullable:True
        /// </summary>           
        //[IEIgnore(IsExportIgnore = true)]
        //[SugarColumn(ColumnName = "spepids")]
        //public string Spepids { get; set; }

        /// <summary>
        /// Desc:上一个审批人
        /// Default:
        /// Nullable:True
        /// </summary>           
        //[IEIgnore(IsExportIgnore = true)]
        //[SugarColumn(ColumnName = "lastepid")]
        //public long Lastepid { get; set; }

        /// <summary>
        /// Desc:下一个审批人
        /// Default:
        /// Nullable:True
        /// </summary>           
        //[IEIgnore(IsExportIgnore = true)]
        //[SugarColumn(ColumnName = "nextepid")]
        //public long Nextepid { get; set; }

        /// <summary>
        /// 软删除标记：1.删除 0.未删除
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "isdel")]
        public int IsDel { get; set; } = 0;

        /// <summary>
        /// Desc:
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "created")]
        public DateTime Created { get; set; }

        /// <summary>
        /// Desc:
        /// Default:
        /// Nullable:True
        /// </summary>           
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(ColumnName = "updated")]
        public DateTime? Updated { get; set; }

        /// <summary>
        /// 对应设备
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(IsIgnore = true)]
        [JsonProperty("device")]
        public Device Device { get; set; }

        /// <summary>
        /// 对应设备
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(IsIgnore = true)]
        [JsonProperty("employee")]
        public Employee Employee { get; set; }

        /// <summary>
        /// 对应设备
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(IsIgnore = true)]
        [JsonProperty("noticerepairresult")]
        public NoticeRepairResult NoticeRepairResult { get; set; }

        /// <summary>
        /// 维修人
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(IsIgnore = true)]
        [JsonProperty("wxemployee")]
        public Employee WxEmployee { get; set; }

        /// <summary>
        /// 报修人
        /// </summary>
        [IEIgnore(IsExportIgnore = true)]
        [SugarColumn(IsIgnore = true)]
        [JsonProperty("sbemployee")]
        public Employee SbEmployee { get; set; }

    }
}
